<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2016/11/12
 * Time: 16:39
 */
namespace Admin\Controller;
use Admin\Controller\CommonController;
class SpreadController extends \Admin\Controller\CommonController{

    function index(){
        if (IS_POST){
            @chmod('./spread.txt', 0777);

            if (!trim(I('content'))) $this->error('请设置邀请好友消息内容');

            $content  = trim(I('content'));
            if (file_put_contents('./spread.txt',$content)){
                $isEdit = 1;
            }else {
                $this->error('没有权限，请修改文件读写权限');
            }
            if ($isEdit){
                $this->success('修改成功');
            }else {
                $this->error('修改失败');
            }
        }else {
            $this->currentpos = $this->menu_db->currentPos(I('menuid'));  //栏目位置
            $this->assign('content',file_get_contents('./spread.txt'));
            $this->display();
        }
    }

}